package fr.ants.controller.draganddrop;

import java.awt.datatransfer.DataFlavor;

import javax.swing.JButton;

/**
 * Factory class used to encapsulate a {@link JButton} during a Drag and Drop
 * Transfer.
 * @author Guillaume Ruscassie
 */
public final class ButtonFlavorFactory {
	/**
	 * Mime type supported for the drag and drop.
	 */
	private final static String mimeType = DataFlavor.javaJVMLocalObjectMimeType
			+ ";class=" + JButton.class.getName();

	/**
	 * Constructor.
	 */
	private ButtonFlavorFactory() {
		// do nothing.
	}

	/**
	 * Returns the {@link DataFlavor}.
	 * 
	 * @return the {@link DataFlavor}
	 */
	protected static DataFlavor getUnitePanelFlavor() {
		// Try to create a DataFlavor for color.
		DataFlavor unitePanelFlavor = null;

		try {
			unitePanelFlavor = new DataFlavor(mimeType);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		return unitePanelFlavor;
	}
}
